package com.xd.auth.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.xd.common.base.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;

/**
 * 储存客户端信息
 * @author hbx
 */
@ApiModel(value="OauthClientDetails")
@Data
@TableName(value = "oauth_client_details")
public class OauthClientDetails  implements Serializable {
    private static final long serialVersionUID = 8484184822265146866L;
    /**
     * 客户端Id
     */
    @TableId(value = "client_id", type = IdType.INPUT)
    @ApiModelProperty(value="客户端Id")
    private String clientId;

    /**
     * 客户端所能访问的资源id集合
     */
    @TableField(value = "resource_ids")
    @ApiModelProperty(value="客户端所能访问的资源id集合")
    private String resourceIds;

    /**
     * 客户端(client)的访问密匙
     */
    @TableField(value = "client_secret")
    @ApiModelProperty(value="客户端(client)的访问密匙")
    private String clientSecret;

    /**
     * 客户端申请的权限范围,
     */
    @TableField(value = "scope")
    @ApiModelProperty(value="客户端申请的权限范围,")
    private String scope;

    /**
     * 指定客户端支持的grant_type,可选值包括authorization_code,password,refresh_token,implicit,client_credentials
     */
    @TableField(value = "authorized_grant_types")
    @ApiModelProperty(value="指定客户端支持的grant_type,可选值包括authorization_code,password,refresh_token,implicit,client_credentials")
    private String authorizedGrantTypes;

    /**
     * 客户端的重定向URI
     */
    @TableField(value = "web_server_redirect_uri")
    @ApiModelProperty(value="客户端的重定向URI")
    private String webServerRedirectUri;

    /**
     * 客户端所拥有的Spring Security的权限值,可选
     */
    @TableField(value = "authorities")
    @ApiModelProperty(value="客户端所拥有的Spring Security的权限值,可选")
    private String authorities;

    /**
     * 客户端的access_token的有效时间值(单位:秒)
     */
    @TableField(value = "access_token_validity")
    @ApiModelProperty(value="客户端的access_token的有效时间值(单位:秒)")
    private Integer accessTokenValidity;

    /**
     * 客户端的refresh_token的有效时间值(单位:秒)
     */
    @TableField(value = "refresh_token_validity")
    @ApiModelProperty(value="客户端的refresh_token的有效时间值(单位:秒)")
    private Integer refreshTokenValidity;

    /**
     * 预留的字段,若设置值,必须是JSON格式的数据
     */
    @TableField(value = "additional_information")
    @ApiModelProperty(value="预留的字段,若设置值,必须是JSON格式的数据")
    private String additionalInformation;

    /**
     * 标识客户端是否已存档(即实现逻辑删除),默认值为’0’(即未存档)
     */
    @TableField(value = "archived")
    @ApiModelProperty(value="标识客户端是否已存档(即实现逻辑删除),默认值为’0’(即未存档)")
    private Boolean archived;

    /**
     * 客户端是否为受信任的,默认为’0’(即不受信任的,1为受信任的)
     */
    @TableField(value = "trusted")
    @ApiModelProperty(value="客户端是否为受信任的,默认为’0’(即不受信任的,1为受信任的)")
    private Boolean trusted;

    /**
     * 用户是否自动Approval操作
     */
    @TableField(value = "autoapprove")
    @ApiModelProperty(value="用户是否自动Approval操作")
    private String autoapprove;

    public static final String COL_CLIENT_ID = "client_id";

    public static final String COL_RESOURCE_IDS = "resource_ids";

    public static final String COL_CLIENT_SECRET = "client_secret";

    public static final String COL_SCOPE = "scope";

    public static final String COL_AUTHORIZED_GRANT_TYPES = "authorized_grant_types";

    public static final String COL_WEB_SERVER_REDIRECT_URI = "web_server_redirect_uri";

    public static final String COL_AUTHORITIES = "authorities";

    public static final String COL_ACCESS_TOKEN_VALIDITY = "access_token_validity";

    public static final String COL_REFRESH_TOKEN_VALIDITY = "refresh_token_validity";

    public static final String COL_ADDITIONAL_INFORMATION = "additional_information";

    public static final String COL_ARCHIVED = "archived";

    public static final String COL_TRUSTED = "trusted";

    public static final String COL_AUTOAPPROVE = "autoapprove";

    public static final String COL_CREATE_BY = "create_by";

    public static final String COL_CREATE_TIME = "create_time";

    public static final String COL_UPDATE_BY = "update_by";

    public static final String COL_UPDATE_TIME = "update_time";
}
